package com.example.demo.LeetCode.string;

public class ReverseString {
    public static  void solution(char[] arr){
        int start = 0;
        int end = arr.length - 1;
        while (start < end){
            char a = arr[start];
            char b = arr[end];
            char temp = a;
            arr[start] = b;
            arr[end] = temp;
            start++;
            end--;
        }
    }

    public static void main(String[] args) {
        String hello = "Hello";
        char[] arr = hello.toCharArray();
        for (char c : arr) {
            System.out.print(c);
        }
        System.out.println("--------------------");
        solution(arr);
        for (char c : arr) {
            System.out.print(c);
        }
    }
}
